package org.example.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;
import org.example.entity.User;
import reactor.core.publisher.Mono;

import java.util.List;

/**
 * TODO 类功能介绍及重点或容易混淆点的说明。
 *
 * @author: 龙小南
 * @Date: 2023/5/20 10:19
 * @Version 1.0[当前版本号]
 *
 * @version 1.0 2023/5/20 10:19 龙小南 新建类[说明]
 */

@Mapper
public interface UserMapper extends BaseMapper<User> {
    @Select("SELECT * FROM users")
    List<User> selectAll();

    @Insert("INSERT INTO users(id, name, age) values (#{id}, #{name}, #{age})")
    int insert(User user);

    @Select("SELECT * from users Where id = #{userId}")
    User selectById(@Param("userId") Long userId);

    @Update("UPDATE users set name = #{name}, age = #{age} where id = #{id}")
    int updateById(User user);

    @Delete("DELETE from users where id = #{userId}})")
    void deleteById(@Param("userId") Long userId);
}
